Embodiments of the present application relate to forwarding data packets in a computer network, and more particularly to techniques for selecting a path such as an Equal Cost MultiPath (ECMP) path and/or a trunk port for forwarding data packets.
Network devices commonly have to select a path from multiple available choices for forwarding a packet. For example, ECMP is a routing strategy where next-hop packet forwarding to a destination can occur over multiple equal cost routing paths. The effect of multipath routing on a network device (e.g., a router) configured to forward packets is that the network device potentially has several next-hops for any given destination and must use some method to choose which path to the next-hop should be used for a given data packet. The use of ECMP helps to reduce delay and congestion in networks by taking advantage of multiple paths through a network by splitting traffic flows across those paths. Accordingly, a network device such as a router has to be able to select a particular ECMP path from multiple available paths to forward a packet.
Trunking is another technique that is commonly used in networks. A trunk represents a logical collection of multiple output ports generally associated with the same route or connected to the same MAC address. In a network environment, when a selected output path for a packet is a trunk, a network device has to be able to select a port from multiple ports associated with the trunk for forwarding the packet. In certain network environments, a selected ECMP path may itself correspond to a trunk. In such an environment, in addition to selecting a particular ECMP path, the network device also has to select a particular output port from the multiple output ports associated with the trunk for forwarding the data packet.
Conventionally, selection of paths (e.g., ECMP paths) and/or trunk ports for data forwarding is done by simply hashing on various fields of a packet header, such as based upon the IP source and destination address fields, and using the hash for selecting the path and/or trunk port. The diversification in the selection offered by such conventional techniques however is quite poor and does not offer proper distribution of traffic to the available paths and/or trunk ports. For example in ECMP forwarding, poor diversification results in the same ECMP path and/or trunk port being selected for forwarding the traffic flow packets at multiple stages of the network. As a result, a router forwards traffic with the same source and destination addresses using the same port of a trunk or the same path, not fully utilizing the bandwidth available for the traffic via other ports or paths available to the router. Accordingly, using conventional techniques in which all routers in the network derive their hashing decision purely based on information extracted from the packet header, correlation occurs among routers that any given packet flow traverses, and such correlation reduces diversification. Further, existing ECMP solutions only work in some network topologies and provide limited diversification.